package com.itheima.web.controller.oms;

import com.itheima.result.AjaxResult;
import com.itheima.service.oms.OrderSettingService;
import com.itheima.vo.oms.OmsOrderSetting;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 订单设置表 前端控制器
 * </p>
 */
@RestController
@RequestMapping("/orderSetting")
public class OmsOrderSettingController {

    @DubboReference
    private OrderSettingService orderSettingService;

    /**
     * 修改指定订单设置
     *
     * @param id:订单设置表中的主键id(按理说是订单id)
     * @param orderSetting:订单设置数据
     * @return
     */
    @PostMapping("/update/{id}")
    public AjaxResult update(@PathVariable Integer id, @RequestBody OmsOrderSetting orderSetting) {
         orderSettingService.updateById(orderSetting);
        return AjaxResult.success("修改成功!");
    }

    /**
     * 获取指定订单设置
     *
     * @param id：订单设置表中的主键id(按理说是订单id)
     * @return
     */
    @GetMapping("/{id}")
    public AjaxResult findById(@PathVariable Integer id) {
        OmsOrderSetting orderSetting = orderSettingService.getById(id);
        return AjaxResult.success(orderSetting);
    }
}